//
//  LLScanViewController.m
//  Weibo
//
//  Created by 李灵斌 on 15-1-30.
//  Copyright (c) 2015年 apple. All rights reserved.
//

#import "LLScanViewController.h"
#import "LLQrcodeTabbar.h"
#define kQrcodeTabbarHeigth 80
#import "LLScanNavigationController.h"
@interface LLScanViewController ()<LLQrcodeTabbarDelegate>
@property (nonatomic, weak) LLQrcodeTabbar *qrcodeBar;

@end

@implementation LLScanViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    // 创建 LLQrcodeTabbar
    [self setupQrcodeTabbar];
    
    
}

// 创建 LLQrcodeTabbar
- (void)setupQrcodeTabbar{
    
    [self.tabBar removeFromSuperview];
    LLQrcodeTabbar *qrcodeBar = [[LLQrcodeTabbar alloc] init];
    qrcodeBar.delegate = self;
    LLScanNavigationController *nav = [self.childViewControllers firstObject];
    nav.delegate =  qrcodeBar;
    self.qrcodeBar = qrcodeBar;
    CGFloat qrcodeBarX = 0;
    CGFloat qrcodeBarH = kQrcodeTabbarHeigth;
    CGFloat qrcodeBarY = self.view.height - qrcodeBarH;
    CGFloat qrcodeBarW = self.view.width;
    qrcodeBar.frame = CGRectMake(qrcodeBarX, qrcodeBarY, qrcodeBarW, qrcodeBarH);
    [self.view addSubview:qrcodeBar];
    
    
}


#pragma mark - LLQrcodeTabbarDelegate
- (void)qrcodeTabbarItemClick:(LLQrcodeTabbar *)tabbar from:(NSInteger)from to:(NSInteger)to{
    
//    LLLog(@"%tu  -- %tu", from, to);
    self.selectedIndex = to;
}

@end
